<extend name="Public:base" />
<block name="header_js">

<script type="text/javascript">
    $(function(){
         $('#checkAll').click(function(){

            var checked = $(this).prop('checked');             
            var inputs = $('#formAccess input[type=checkbox]');
     
            if (checked) {
                inputs.prop('checked', true);
            }else {
                inputs.prop('checked', false);
            }
            
        });

    });
 
</script>
</block>

<block name="content">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em> 
            {$meta_title}        
            </h3>
        </div>        
    </div>

    <div class="row margin-botton">
        <div class="col-lg-12">
            <div class="btn-group btn-group-md">           
                <button class="btn btn-primary" type="button" onclick="goUrl('{:U('index')}')"><em class="glyphicon glyphicon-chevron-left"></em> 返回</button>
                <button class="btn btn-info" type="button" onclick="doGoSubmit('{:U('categoryAccess')}', 'formAccess')"><em class="glyphicon glyphicon-saved"></em> 更新权限</button>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 column">
            <p>
                <label class="checkbox-inline" for="checkAll">                    
                    <input type="checkbox" id="checkAll"  />
                    <span class=" label label-default">全部选择</span>
                </label>
            </p>
            
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <form action="{:U('Category/sort')}" method="post" id="formAccess">
                <input type="hidden" name="id" value="{$id}">
                <div class="table-responsive">
                    <table class="table table-hover xyh-table-bordered-out-small">
                        <thead>
                            <tr class="active">
                                <th>名称</th>                                
                                <th>查看</th>
                                <th>添加</th>
                                <th>修改</th>
                                <th>删除</th>
                                <th>移动</th>
                                <th>回收站</th>
                                <th>还原</th>
                                <th>清除</th>
                            </tr>
                        </thead>
                        <tbody>
                        <foreach name='cate' item='v'>
                            <tr>
                                <td class="aleft" data-id="{$v.id}">{$v.delimiter}<if condition="$v['pid'] neq 0">├─</if><a>{$v.name}</a></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="index,{$v.id}" <if condition="in_array('index',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="add,{$v.id}" <if condition="in_array('add',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="edit,{$v.id}" <if condition="in_array('edit',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="del,{$v.id}" <if condition="in_array('del',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="move,{$v.id}" <if condition="in_array('move',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="trach,{$v.id}" <if condition="in_array('trach',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="restore,{$v.id}" <if condition="in_array('restore',$v['_access'])">checked="checked"</if> /></td>
                                <td align="center"><input type="checkbox" name="acc_roleid[]" value="clear,{$v.id}" <if condition="in_array('clear',$v['_access'])">checked="checked"</if> /></td>
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                </div>
            </form>

            
        </div>
    </div>

</block>